package org.xingyun.service;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.xingyun.bean.Cities;
import org.xingyun.dao.CityDao;

import java.sql.SQLException;
import java.util.List;

public class CityService {

    public String getAllCity(String id) throws SQLException, JsonProcessingException {
        CityDao cityDao = new CityDao();
        List<Cities> cities = cityDao.selectAll(id);
        String s = new ObjectMapper().writeValueAsString(cities);
        return s;
    }
}
